<?php
class Randstand_Net_Socket_Server_Command_Broadcast
{
    public function BroadcastCommand($argArgument, Randstand_Net_Socket_Server_Client $argClient)
    {
        $broadcastMsg = Randstand_Net_Socket_Server_Message::getInstance()
                            ->getFormattedMessage('broadcast', $argArgument);
        
        $clients = Randstand_Net_Socket_Server::getInstance()->getClients();
        
        $client = null;
	    foreach ($clients as $client) {
	        if ($client->getToken() != $argClient->getToken()) {
	            $client->sendMessage($broadcastMsg);
	        }
	        else {
	            $msg = Randstand_Net_Socket_Server_Message::getInstance()
                    ->getFormattedMessage('valid_request');
	            $argClient->sendMessage($msg);
	        }
	    }
	    
        return true;
    }
}
?>